#ifndef GCONSOLE_H
#define GCONSOLE_H
#include "Game.h"
#include <map>

/**Purpose of this class is to abstract console command flow from the main function.
Gconsole is dependent of the Main function
Takes action on the list, game n and quit commands
*/
class Gconsole
{
public:
	Gconsole(void);

	/** Constructor that accepts a vector of game instances
	*/
	Gconsole(std::vector<Game*> instances);

	~Gconsole(void);
	
	/** Adds game to vector gameList
	*/
	void AddGame(Game* gameInstance);

	//Pre condition: Requires a command string
	void ParseCommand(std::stringstream& command);
	//Post condition: String parsed and requested command called upon
	
	//Called on each prase of GetCommand
	bool keepRunning();
	//Returns true if GetCommand parses Quit command
private:
	//Lists games and their selection number
	std::string list();

	//changes value of quitFlag which makes keepRunning return false
	void quit();

	//Initialized map member that maps strings and command to enum
	void initMapCommands();

	//List of game instances
	std::vector<Game*> gameList;
	int currGame;
	//Initialized to false, if it becomes true, keepPlaying() returns false
	bool quitFlag;
	//Enum that represents allowed commands. Used for selection
	static enum allowedCommands {	
		listG = 1 ,
		gameG = 2 ,
		quitG = 3,
		debugG = 4
								//G used instead of command name only since a function quit exists
};
	//Map that pairs command strings with enum of comands
	std::map<std::string, allowedCommands> mapAllowedCommands;
	Debug* debugger;
};
#endif // GCONSOLE_H